#include <iostream>
#include <vector>

void bubbleSort(int *arr, int n) // 冒泡
{
    for (int j = 1; j < n; j++)
    {
        for (int i = n - 1; i >= j; i--)
        {
            int num;
            if (arr[i] < arr[i - 1])
            {
                num = arr[i];
                arr[i] = arr[i - 1];
                arr[i - 1] = num;
            }
        }
    }

    for (int i = 0; i < n; i++)
    {
        std::cout << arr[i];
    }
}

void insertionSort(int *arr, int n) // 插入
{
    for (int i = 1; i < n; i++)
    {
        int temp = arr[i];
        int j = i - 1;
        while (j >= 0 && temp < arr[j])
        {
            arr[j + 1] = arr[j];
            j--;
        }
        arr[j + 1] = temp;

        for (int i = 0; i < n; i++)
        {
            std::cout << arr[i];
        }
        std::cout << std::endl;
    }
}
void selectionSort(int *arr, int n) // 查询
{
    for (int i = 0; i < n; i++)
    {
        int temp = i;
        for (int j = i + 1; j < n; j++)
        {
            if (arr[temp] > arr[j])
            {
                temp = j;
            }
        }
        int num;
        num = arr[i];
        arr[i] = arr[temp];
        arr[temp] = num;
        for (int j = 0; j < n; j++)
        {
            std::cout << arr[j];
        }
        std::cout << std::endl;
    }
}
int binarySearch(int *arr, int n, int target) // 二分
{
    int right = n - 1;
    int left = 0;
    while (left <= right)
    {
        int mid = left + (right - left) / 2;
        if (arr[mid] < target)
        {
            left = mid + 1;
        }
        else if (arr[mid] > target)
        {
            right = mid - 1;
        }
        else
        {
            return mid;
        }
    }
    return -1;
}
std::vector<int>  twoSum(std::vector<int>& nums, int target)
{
    for(int i=0;i<nums.size();i++)
    {
        for(int j=i+1;j<nums.size();j++)
        {
            if(nums[i]+nums[j]==target)
            {
                return {i,j};
            }
        }
    }
    return {};
}
int main()
{
    std::vector<int> lists= {5, 2, 9, 1, 5, 6}; 
    
    std::vector<int> temp=twoSum(lists,10);
    if(temp.size()>0)
    {
        std::cout<<lists[temp[0]]<<"+"<<lists[temp[1]]<<std::endl;
    }   
    
    return 0;
}